<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>Kiss OS Administrator</title>
        <meta http-equiv="Content-Language" content="en" />
        <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
        <meta name="Steelsquid Kiss OS" content="Administrate/Control/Configure steelsquid-kiss-os from web browser." />
        <meta name="keywords" content="steelsquid, steelsquid-kiss-os, raspberry, pi, debian, linux, distribution, administrator, configure" />
        <meta name="author" content="Andreas Nilsson (Steelsquid)" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
        <link rel="icon" href="favicon.ico" type="image/x-icon"/>
        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
        <link rel="stylesheet" type="text/css" href="steelsquid.css"/>
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript" src="steelsquid.js"></script>
        <script type="text/javascript">
            //<![CDATA[ 

            /**
             * Is loclahost connecting
             */
            function on_localhost(paramaters){
                if(paramaters[0] == "True"){
                    $("#localhost").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to listen to all interfaces?', 'localhost', 'False');\">Listen on all interfaces</button>");
                    $("#localhost_info").html("&nbsp;Current status: Listening on localhost");
                }
                else{
                    $("#localhost").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to only listen on localhost?', 'localhost', 'True');\">Only listen on localhost</button>");
                    $("#localhost_info").html("&nbsp;Current status: Listening on all interfaces");
                }
            }


            /**
             * system info
             */
            function on_system_info(paramaters){
                $("#p_date").html(paramaters[0]);
                $("#p_hostname").html(paramaters[1]);
                $("#p_development").html(paramaters[2]);
                $("#p_boot").html(paramaters[3]);
                $("#p_up").html(paramaters[4]);
                $("#p_users").html(paramaters[5]);
                $("#p_load").html(paramaters[6]);
                $("#p_ip_wired").html(paramaters[7]);
                $("#p_ip_wifi").html(paramaters[8]);
                $("#p_ip_wan").html(paramaters[9]);
                $("#p_access_point").html(paramaters[10]);
                $("#p_cpu").html(paramaters[11]);
                $("#p_cpu_f").html(paramaters[12]);
                $("#p_count").html(paramaters[13]);
                $("#p_temp").html(paramaters[14]);
                $("#p_ram_total").html(paramaters[15]);
                $("#p_ram_free").html(paramaters[16]);
                $("#p_ram_used").html(paramaters[17]);
                $("#p_disk_size").html(paramaters[18]);
                $("#p_disk_used").html(paramaters[19]);
                $("#p_disk_aval").html(paramaters[20]);
                $("#p_overclock").html(paramaters[21]);
                $("#p_gpu_mem").html(paramaters[22]);
                $("#p_log").html(paramaters[23]);
                $("#p_disable_monitor").html(paramaters[24]);
                $("#p_camera").html(paramaters[25]);
                $("#p_timezone").html(paramaters[26]);
                $("#p_keyb").html(paramaters[27]);
                $("#p_web").html(paramaters[28]);
                $("#p_web_local").html(paramaters[29]);
                $("#p_web_https").html(paramaters[30]);
                $("#p_web_aut").html(paramaters[31]);
                $("#p_ssh").html(paramaters[32]);
                $("#p_has_lcd").html(paramaters[33]);
                $("#p_stream").html(paramaters[34]);
                $("#p_socket").html(paramaters[35]);
                $("#p_rover").html(paramaters[36]);
                $("#p_download").html(paramaters[37]);
                $("#p_download_dir").html(paramaters[38]);
                $("#p_io").html(paramaters[39]);
                $("#p_power").html(paramaters[40]);
                $("#p_modem").html(paramaters[41]);
            }

            /**
             * System info error
             */
            function on_system_info_err(err){
                $("#p_date").html("---");
                $("#p_hostname").html("---");
                $("#p_development").html("---");
                $("#p_boot").html("---");
                $("#p_up").html("---");
                $("#p_users").html("---");
                $("#p_load").html("---");
                $("#p_ip_wired").html("---");
                $("#p_ip_wifi").html("---");
                $("#p_ip_wan").html("---");
                $("#p_access_point").html("---");
                $("#p_cpu").html("---");
                $("#p_cpu_f").html("---");
                $("#p_count").html("---");
                $("#p_temp").html("---");
                $("#p_ram_total").html("---");
                $("#p_ram_free").html("---");
                $("#p_ram_used").html("---");
                $("#p_disk_size").html("---");
                $("#p_disk_used").html("---");
                $("#p_disk_aval").html("---");
                $("#p_overclock").html("---");
                $("#p_gpu_mem").html("---");
                $("#p_log").html("---");
                $("#p_disable_monitor").html("---");
                $("#p_camera").html("---");
                $("#p_timezone").html("---");
                $("#p_keyb").html("---");
                $("#p_web").html("---");
                $("#p_web_local").html("---");
                $("#p_web_https").html("---");
                $("#p_web_aut").html("---");
                $("#p_ssh").html("---");
                $("#p_has_lcd").html("---");
                $("#p_stream").html("---");
                $("#p_socket").html("---");
                $("#p_rover").html("---");
                $("#p_download").html("---");
                $("#p_download_dir").html("---");
                $("#p_io").html("---");
                $("#p_power").html("---");
                $("#p_modem").html("---");
            }

            /**
             * Get status on network
             */
            function on_wifi_status(paramaters){
                $("#wifi_connected").html(paramaters[0]);
                $("#wifi_wired").html(paramaters[1]);
                $("#wifi_wifi").html(paramaters[2]);
                $("#wifi_wan").html(paramaters[3]);
            }

            /**
             * On Network error
             */
            function on_wifi_status_err(err){
                $("#wifi_connected").html(err);
                $("#wifi_wired").html("---");
                $("#wifi_wifi").html("---");
                $("#wifi_wan").html("---");
            }

            /**
             * On List all wifi
             */
            function on_wifi_list(paramaters){
                tbody = $("#wifi_list").find('tbody');
                tbody.empty();
                if(paramaters.length > 1){
                    for(var i = 0; i<paramaters.length; i++){
                        var name = paramaters[i];
                        i++;
                        var sec = paramaters[i];
                        tbody.append("<tr><td>" + sec + "&nbsp;&nbsp;&nbsp;</td><td><a href=\"javascript:submit_wifi_connect('" + name + "', '" + sec + "')\">" + name + "</a></td></tr>");
                    }
                }
                if(paramaters.length == 1){
                    tbody.append("<tr><td colspan='2' class='highlight'>No wireless network found!</td></td></tr>");
                }
            }
            
            /**
             * Submit connect to wifi
             */
            function submit_wifi_connect(name, sec){
                if(sec == "Open"){
                    submitSync('wifi_connect', name, sec);
                }
                else{
                    pass = window.prompt("Please enter password for wifi " + name, "");
                    if(pass){
                        submitSync('wifi_connect', name, sec, pass);
                    }
                }
            }

            /**
             * On connected to wifi
             */
            function on_wifi_connect(err){
            }
            
            /**
             * On add sshfs mount point
             */
            function on_sshfs_add(paramaters){
                showAlertMedium(paramaters[0], false);
                submitSync('sshfs_get');
                submitSync('sshfs_local_get');
            }
            
            /**
             * On del sshfs mount point
             */
            function on_sshfs_del(paramaters){
                showAlertMedium(paramaters[0], false);
                submitSync('sshfs_get');
                submitSync('sshfs_local_get');
            }
            
            /**
             * On mount
             */
            function on_sshfs_mount(paramaters){
                showAlertMedium(paramaters[0], false);
                submitSync('sshfs_get');
            }
            
            /**
             * On umount
             */
            function on_sshfs_umount(paramaters){
                showAlertMedium(paramaters[0], false);
                submitSync('sshfs_get');
            }
            
            /**
             * Get all mount points
             */
            function on_sshfs_get(paramaters){
                tbody = $("#sshfs_list").find('tbody');
                tbody.empty();
                if(paramaters.length > 1){
                    for(var i = 0; i<paramaters.length; i++){
                        var count = paramaters[i];
                        i++;
                        var ip = paramaters[i];
                        i++;
                        var port = paramaters[i];
                        i++;
                        var user = paramaters[i];
                        i++;
                        var local = paramaters[i];
                        i++;
                        var remote = paramaters[i];
                        i++;
                        var mounted = paramaters[i];
                        i++;
                        var hasPass = paramaters[i];

                        var html = [];
                        html.push("<tr><td>");
                        if(hasPass == "True"){
                            if (mounted == "True"){
                                html.push("<button onclick=\"javascript:submitSync('sshfs_umount', '" + count + "')\">Unmount</button>");
                                html.push("<br />");
                                html.push("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to delete the mount point', 'sshfs_del', '" + count + "')\">Delete</button>");
                            }
                            else{
                                html.push("<button onclick=\"javascript:submitSync('sshfs_mount', '" + count + "')\">Mount</button>");
                                html.push("<br />");
                                html.push("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to delete the mount point', 'sshfs_del', '" + count + "')\">Delete</button>");
                            }
                        }
                        else{
                            if (mounted == "True"){
                                html.push("<button onclick=\"javascript:submitSync('sshfs_umount', '" + count + "')\">Unmount</button>");
                                html.push("<br />");
                                html.push("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to delete the mount point', 'sshfs_del', '" + count + "')\">Delete</button>");
                            }
                            else{
                                html.push("<button onclick=\"javascript:var pass=window.prompt('Please enter password', '');if(pass!=null){submitSync('sshfs_mount', '" + count + "', pass);}\">Mount</button>");
                                html.push("<br />");
                                html.push("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to delete the mount point', 'sshfs_del', '" + count + "')\">Delete</button>");
                            }
                        }
                        html.push("</td><td class='wrap'>");
                        html.push(ip + ":" + port);
                        html.push("<br />");
                        html.push(user);
                        html.push("</td><td class='wrap'>");
                        html.push(remote);
                        html.push("<br />");
                        html.push(local);
                        html.push("</td></tr>");
                        tbody.append(html.join(""));
                    }
                }
                if(paramaters.length == 1){
                    tbody.append("<tr><td colspan='3' class='highlight'>Please add a mount pount!</td></td></tr>");
                }
            }
            
            /**
             * On Get local mount points
             */
            function on_sshfs_local_get(paramaters){
                tlist = $("#sshfs_local_list");
                tlist.empty();
                for(var i = 0; i<paramaters.length; i++){
                    tlist.append('<option value="' + paramaters[i] + '">' + paramaters[i] + '</option>');
                }
            }
            
            /**
             * On del local mount pin
             */
            function on_sshfs_local_del(paramaters){
                submitSync('sshfs_local_get');
                showAlertMedium(paramaters[0], false);
            }
            
            /**
             * On new local mount point
             */
            function on_sshfs_local_add(paramaters){
                submitSync('sshfs_local_get');
                showAlertMedium(paramaters[0], false);
            }

            /**
             * On add mount point
             */
            function on_samba_add(paramaters){
                showAlertMedium(paramaters[0], false);
                submitSync('samba_get');
                submitSync('samba_local_get');
            }
            
            /**
             * On del mount point
             */
            function on_samba_del(paramaters){
                showAlertMedium(paramaters[0], false);
                submitSync('samba_get');
                submitSync('samba_local_get');
            }
            
            /**
             * On mount
             */
            function on_samba_mount(paramaters){
                showAlertMedium(paramaters[0], false);
                submitSync('samba_get');
            }
            
            /**
             * On umount
             */
            function on_samba_umount(paramaters){
                showAlertMedium(paramaters[0], false);
                submitSync('samba_get');
            }
            
            /**
             * On get all mount points
             */
            function on_samba_get(paramaters){
                tbody = $("#samba_list").find('tbody');
                tbody.empty();
                if(paramaters.length > 1){
                    for(var i = 0; i<paramaters.length; i++){
                        var count = paramaters[i];
                        i++;
                        var ip = paramaters[i];
                        i++;
                        var user = paramaters[i];
                        i++;
                        var local = paramaters[i];
                        i++;
                        var remote = paramaters[i];
                        i++;
                        var mounted = paramaters[i];

                        var html = [];
                        html.push("<tr><td>");
                        if (mounted == "True"){
                            html.push("<button onclick=\"javascript:submitSync('samba_umount', '" + count + "')\">Unmount</button>");
                            html.push("<br />");
                            html.push("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to delete the mount point', 'samba_del', '" + count + "')\">Delete</button>");
                        }
                        else{
                            html.push("<button onclick=\"javascript:submitSync('samba_mount', '" + count + "')\">Mount</button>");
                            html.push("<br />");
                            html.push("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to delete the mount point', 'samba_del', '" + count + "')\">Delete</button>");
                        }
                        html.push("</td><td class='wrap'>");
                        html.push(ip);
                        html.push("<br />");
                        html.push(user);
                        html.push("</td><td class='wrap'>");
                        html.push(remote);
                        html.push("<br />");
                        html.push(local);
                        html.push("</td></tr>");
                        tbody.append(html.join(""));
                    }
                }
                if(paramaters.length == 1){
                    tbody.append("<tr><td colspan='3' class='highlight'>Please add a mount pount!</td></td></tr>");
                }
            }
            
            /**
             * On get local mount point
             */
            function on_samba_local_get(paramaters){
                tlist = $("#samba_local_list");
                tlist.empty();
                for(var i = 0; i<paramaters.length; i++){
                    tlist.append('<option value="' + paramaters[i] + '">' + paramaters[i] + '</option>');
                }
            }
            
            /**
             * On delete local mount point
             */
            function on_samba_local_del(paramaters){
                submitSync('samba_local_get');
                showAlertMedium(paramaters[0], false);
            }
            
            /**
             * Add new local mount point
             */
            function on_samba_local_add(paramaters){
                submitSync('samba_local_get');
                showAlertMedium(paramaters[0], false);
            }
            
            /**
             * Clear samba remote dir
             */
            function clearSambaRemoteDiv(){
                $("#samba_remote_div").html("<input type='text' id='samba_remote' value='' />");
            }
            
            /**
             * Get all shares on the server
             */
            function on_samba_list(paramaters){
                showAlertMedium("Share retrieved from the server", false);
                var html = [];
                html.push("<select id='samba_remote'>");
                for(var i = 0; i<paramaters.length; i++){
                    html.push('<option value="' + paramaters[i] + '">' + paramaters[i] + '</option>');
                }
                html.push("</select>");
                $("#samba_remote_div").html(html.join(""));
            }

            /**
             * Hostname
             */
            function on_hostname_get(paramaters){
                setValue("hostname_name", paramaters[0]);
            }

            /**
             * Download
             */
            function on_download(paramaters){
                if(paramaters[0]=="True"){
                    setContent("download_status", "Enabled");
                    enable("download_disable");
                    disable("download_enable");
                }
                else{
                    setContent("download_status", "Disabled");
                    enable("download_enable");
                    disable("download_disable");
                }
                setValue("download_dir", paramaters[1]);
            }

            /**
             * On timezone list
             */
            function on_tz_list(paramaters){
                tbody = $("#tz_list").find('tbody');
                tbody.empty();
                for(var i = 0; i<paramaters.length; i++){
                    var name = paramaters[i];
                    tbody.append("<tr><td><a href=\"javascript:submitSyncConfirm('Are you sure you want to change timezone?', 'tz_set', '" + name + "');\">" + name + "</a></td></tr>");
                }
            }

            /**
             * On get current timezone
             */
            function on_tz_get(paramaters){
                $("#tz_current").html(paramaters[0]);
                $("#tz_date").html(paramaters[1]);
            }

            /**
             * On set timezone
             */
            function on_tz_set(paramaters){
                submitSync('tz_get');
                showAlertMedium("Timezone changed", false);
            }

            /**
             * On set keyboard
             */
            function on_keyboard_set(paramaters){
                $("#keyboard_current").html(paramaters[0]);
                showAlertMedium("Keyboard changed", false);
            }

            /**
             * On get keyboard
             */
            function on_keyboard_get(paramaters){
                $("#keyboard_current").html(paramaters[0]);
            }

            /**
             * On list all keyboard
             */
            function on_keyboard_list(paramaters){
                tbody = $("#keyboard_list").find('tbody');
                tbody.empty();
                for(var i = 0; i<paramaters.length; i++){
                    var name = paramaters[i];
                    tbody.append("<tr><td><a href=\"javascript:submitSyncConfirm('Are you sure you want to change keyboard?', 'keyboard_set', '" + name + "');\">" + name + "</a></td></tr>");
                }
            }

            /**
             * Get mail 
             */
            function on_mail_get(paramaters){
                $("#mail_host").val(paramaters[0]);
                $("#mail_username").val(paramaters[1]);
                $("#mail_mail").val(paramaters[2]);
            }
            
            /**
             * Set mail 
             */
            function on_mail_set(paramaters){
                showAlertMedium("Settings saved", false);
            }
            
            /**
             * Test mail 
             */
            function on_mail_test(paramaters){
                showAlertMedium("A test mail is sent, check you mailbox", false);
            }
                        
 
             /**
             * On disable ssh server
             */
            function on_ssh_dis(paramaters){
                if(paramaters[0] == "True"){
                    $("#ssh_disable_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to enable SSH server?', 'ssh_dis', 'False');\">Enable SSH-server</button>");
                    $("#ssh_disable_info").html("SSH disabled");
                }
                else{
                    $("#ssh_disable_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to disable SSH server?', 'ssh_dis', 'True');\">Disable SSH-server</button>");
                    $("#ssh_disable_info").html("SSH enabled");
                }
            }

            /**
             * On disable web interface
             */
            function on_web_interface_disable(paramaters){
                if(paramaters[0] == "True"){
                    $("#web_interface_disable_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to enable the adminitrator interface?', 'web_interface_disable', 'False');\">Enable adminitrator interface</button>");
                    $("#web_interface_disable_info").html("Web-interface disabled");
                }
                else{
                    $("#web_interface_disable_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to disable the adminitrator interface?', 'web_interface_disable', 'True');\">Disable adminitrator interface</button>");
                    $("#web_interface_disable_info").html("Web-interface enabled");
                }
            }

            /**
             * On web interface only listen to localhost
             */
            function on_web_interface_localhost(paramaters){
                if(paramaters[0] == "True"){
                    $("#web_interface_localhost_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to listen to all interfaces?', 'web_interface_localhost', 'False');\">Listen on all interfaces</button>");
                    $("#web_interface_localhost_info").html("Listening on localhost");
                }
                else{
                    $("#web_interface_localhost_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to only listen on localhost?', 'web_interface_localhost', 'True');\">Only listen on localhost</button>");
                    $("#web_interface_localhost_info").html("Listening on all interfaces");
                }
            }

            /**
             * On web interface http/https
             */
            function on_web_interface_https(paramaters){
                if(paramaters[0] == "True"){
                    $("#web_interface_https_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to use unsecure http?', 'web_interface_https', 'False');\">Switch to HTTP</button>");
                    $("#web_interface_https_info").html("Using secure HTTPS");
                }
                else{
                    $("#web_interface_https_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to use secure https?', 'web_interface_https', 'True');\">Switch to HTTPS</button>");
                    $("#web_interface_https_info").html("Using unsecure HTTP");
                }
                setValue('web_interface_port', paramaters[1])
                submitNoPW('web_interface_disable');
            }

            /**
             * On web interface authentication
             */
            function on_web_interface_authentication_on(paramaters){
                on_web_interface_authentication(paramaters);
            }
            /**
             * On web interface authentication
             */
            function on_web_interface_authentication_off(paramaters){
                on_web_interface_authentication(paramaters);
            }
            /**
             * On web interface authentication
             */
            function on_web_interface_authentication(paramaters){
                if(paramaters[0] == "True"){
                    $("#web_interface_authentication_button").html("<button onclick=\"javascript:submitSyncFromPrompt('web_interface_authentication_off', 'Please enter password for the user root?', '');\">Disable authentication</button>");
                    $("#web_interface_authentication_info").html("Authentication enabled");
                }
                else{
                    $("#web_interface_authentication_button").html("<button onclick=\"javascript:submitSyncFromPrompt('web_interface_authentication_on', 'Please enter password for the user root?', '');\">Enable authentication</button>");
                    $("#web_interface_authentication_info").html("Authentication disabled");
                }
                setValue('web_interface_authentication', paramaters[1])
            }


            /**
             * On web interface share /mnt, /media and /home/steelsquid
             */
            function on_web_interface_share(paramaters){
                if(paramaters[0] == "True"){
                    $("#web_interface_share_button").html("<button onclick=\"javascript:submitSyncFromPrompt('web_interface_share_off', 'Please enter password for the user root?', '');\">Disable access</button>");
                    $("#web_interface_share_info").html("Access to /root is enabled");
                }
                else{
                    $("#web_interface_share_button").html("<button onclick=\"javascript:submitSyncFromPrompt('web_interface_share_on', 'Please enter password for the user root?', '');\">Enable access</button>");
                    $("#web_interface_share_info").html("Access to /root is disabled");
                }
            }
            function on_web_interface_share_on(paramaters){
                on_web_interface_share(paramaters);
            }
            function on_web_interface_share_off(paramaters){
                on_web_interface_share(paramaters);
            }

            /**
             * Rover
             */
            function on_rover_info(paramaters){
                if(paramaters[0] == "True"){
                    $("#rover_button").html("<button onclick=\"javascript:submitSyncFromPrompt('rover_disable', 'Please enter password for the user root?', '');\">Disable Rover</button>");
                    $("#rover_info").html("The Rover Controller is enabled");
                }
                else{
                    $("#rover_button").html("<button onclick=\"javascript:submitSyncFromPrompt('rover_enable', 'Please enter password for the user root?', '');\">Enable Rover</button>");
                    $("#rover_info").html("The Rover Controller  disabled");
                }
            }
            function on_rover_enable(paramaters){
                on_rover_info(paramaters);
            }
            function on_rover_disable(paramaters){
                on_rover_info(paramaters);
            }
            

            /**
             * Download
             */
            function on_downman(paramaters){
                if(paramaters[0] == "True"){
                    $("#download_button").html("<button onclick=\"javascript:submitSyncFromPrompt('downman_disable', 'Please enter password for the user root?', '');\">Disable Download manager</button>");
                    $("#download_info").html("The Download manager is enabled");
                }
                else{
                    $("#download_button").html("<button onclick=\"javascript:submitSyncFromPrompt('downman_enable', 'Please enter password for the user root?', '');\">Enable Download manager</button>");
                    $("#download_info").html("The Download manager  disabled");
                }
            }
            function on_downman_enable(paramaters){
                on_downman(paramaters);
            }
            function on_downman_disable(paramaters){
                on_downman(paramaters);
            }

            /**
             * Check ansync upgrade work
             * status: idle, busy, err, ok
             *   idle=No work has executed
             *   busy=Working
             *   err=Work finish with error
             *   ok=Work finish OK
             * error: only if status=='err'
             */
            function on_upgrade(status, error, paramaters){
                setContent("upgrade_log", paramaters, false);
                if(status == "idle"){
                    enable("upgrade_button_small");
                    enable("upgrade_button_full");
                    enable("upgrade_button_reset");
                    status_idle("upgrade_status");
                }
                else if(status == "busy"){
                    disable("upgrade_button_small");
                    disable("upgrade_button_full");
                    disable("upgrade_button_reset");
                    status_busy("upgrade_status");
                }
                else if(status == "err"){
                    enable("upgrade_button_small");
                    enable("upgrade_button_full");
                    enable("upgrade_button_reset");
                    status_err("upgrade_status");
                    appendContent("upgrade_log", error, true);
                    showAlertMedium(error, true, true);
                }
                else if(status == "ok"){
                    enable("upgrade_button_small");
                    enable("upgrade_button_full");
                    enable("upgrade_button_reset");
                    status_ok("upgrade_status");
                }
                scrollToBottomIfChanged("upgrade_log");
            }

            /**
             * On expand filesystem
             */
            function on_expand(paramaters){
                status_ok("expand_status", paramaters[0]);
                show("expand_reboot");
            }
            
            /**
             * On monitor disabled
             */
            function on_monitor_disable(paramaters){
                if(paramaters[0] == "True"){
                    $("#monitor_disable").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to enable the display?', 'monitor_disable', 'False');\">Enable the display</button>");
                    $("#monitor_disable_info").html("Displa disabled");
                }
                else{
                    $("#monitor_disable").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to disable the display?', 'monitor_disable', 'True');\">Disable the display</button>");
                    $("#monitor_disable_info").html("Display enabled");
                }
            }

            /**
             * On camera
             */
            function on_camera(paramaters){
                if(paramaters[0] == "True"){
                    $("#camera_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to disable the camera?', 'camera', 'False');\">Disable the camera</button>");
                    $("#camera_info").html("Camera enabled");
                }
                else{
                    $("#camera_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to enable the camera?', 'camera', 'True');\">Enable the camera</button>");
                    $("#camera_info").html("Camera disabled");
                }
            }

            /**
             * On stream
             */
            function on_stream(paramaters){
                if(paramaters[0] == "True"){
                    $("#stream_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to disable the streaming?', 'stream', 'False');\">Disable the Streaming</button>");
                    $("#stream_info").html("Streaming enabled");
                }
                else{
                    $("#stream_button").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to enable the streaming?', 'stream', 'True');\">Enable the Streaming</button>");
                    $("#stream_info").html("Streaming disabled");
                }
            }


            /**
             * On overclock
             */
            function on_overclock(paramaters){
                if(paramaters[0] == "over"){
                    $("#overclock_button_under").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to underclock the device?', 'overclock', 'under');\">Underclock</button>");
                    $("#overclock_button_default").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to set default clocking on the device?', 'overclock', 'default');\">Default</button>");
                    $("#overclock_button_over").html("<button disabled=\"disabled\" onclick=\"javascript:submitSyncConfirm('Are you sure you want to overclock the device?', 'overclock', 'over');\">Overclock</button>");
                    $("#overclock_button_info").html("Overclocking enabled");
                }
                else if(paramaters[0] == "under"){
                    $("#overclock_button_under").html("<button disabled=\"disabled\"  onclick=\"javascript:submitSyncConfirm('Are you sure you want to underclock the device?', 'overclock', 'under');\">Underclock</button>");
                    $("#overclock_button_default").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to set default clocking on the device?', 'overclock', 'default');\">Default</button>");
                    $("#overclock_button_over").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to overclock the device?', 'overclock', 'over');\">Overclock</button>");
                    $("#overclock_button_info").html("Underclocking enabled");
                }
                else{
                    $("#overclock_button_under").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to underclock the device?', 'overclock', 'under');\">Underclock</button>");
                    $("#overclock_button_default").html("<button disabled=\"disabled\" onclick=\"javascript:submitSyncConfirm('Are you sure you want to set default clocking on the device?', 'overclock', 'default');\">Default</button>");
                    $("#overclock_button_over").html("<button onclick=\"javascript:submitSyncConfirm('Are you sure you want to overclock the device?', 'overclock', 'over');\">Overclock</button>");
                    $("#overclock_button_info").html("Default clocking");
                }
            }

            /**
             * gpu mem
             */
            function on_gpu_mem_get(paramaters){
                setValue("gpu_mem", paramaters[0]);
            }

            /**
             * On lcd
             */
            function on_lcd(paramaters){
                if(paramaters[0] == "False"){
                    enable("lcd_button_auto")
                    enable("lcd_button_hdd")
                    enable("lcd_button_nokia")
                    enable("lcd_button_ssd")
                    disable("lcd_button_disable")
                    status_ok("lcd_status", "LCD disabled");
                }
                else if(paramaters[0] == "hdd"){
                    enable("lcd_button_auto")
                    disable("lcd_button_hdd")
                    enable("lcd_button_nokia")
                    enable("lcd_button_ssd")
                    enable("lcd_button_disable")
                    status_ok("lcd_status", "LCD HDD44780");
                }
                else if(paramaters[0] == "nokia"){
                    enable("lcd_button_auto")
                    enable("lcd_button_hdd")
                    disable("lcd_button_nokia")
                    enable("lcd_button_ssd")
                    enable("lcd_button_disable")
                    status_ok("lcd_status", "LCD nokia5110");
                }
                else if(paramaters[0] == "ssd"){
                    enable("lcd_button_auto")
                    enable("lcd_button_hdd")
                    enable("lcd_button_nokia")
                    disable("lcd_button_ssd")
                    enable("lcd_button_disable")
                    status_ok("lcd_status", "LCD automatic");
                }
                else if(paramaters[0] == "auto"){
                    disable("lcd_button_auto")
                    enable("lcd_button_hdd")
                    enable("lcd_button_nokia")
                    enable("lcd_button_disable")
                    status_ok("lcd_status", "LCD automatic");
                }
            }
            
            /**
             * On lcd
             */
            function on_lcd_disable(paramaters){
                on_lcd(paramaters);
            }
            
            /**
             * On lcd
             */
            function on_lcd_hdd(paramaters){
                on_lcd(paramaters);
            }

            /**
             * On lcd
             */
            function on_lcd_nokia(paramaters){
                on_lcd(paramaters);
            }

            /**
             * On lcd
             */
            function on_lcd_ssd(paramaters){
                on_lcd(paramaters);
            }

            /**
             * On lcd
             */
            function on_lcd_auto(paramaters){
                on_lcd(paramaters);
            }
            
            /**
             * When the page is loaded
             */
            function onPageLoad(){
                if($(window).width() > 600){
                    $("#info_row_1").html($("#info_1").html())
                    $("#info_1").html("")
                    $("#info_row_2").html($("#info_2").html())
                    $("#info_2").html("")
                    showLayer('main2');
                }
                else{
                    showLayer('main');
                }
            }
            
            /**
             * When go back or middle mouse button or esc pressed
             */
            function onBack(){
                if($(window).width() > 600){
                    showLayer('main2');
                }
                else{
                    showLayer('main');
                }
            }
            
            /**
             * This will execute every 10 second
             */
            function onEvery05s(){
                if(isLayerShowing("lcd")){
                    submitNoPW('lcd');
                }
            }

            /**
             * This will execute every 10 second
             */
            function onEvery10s(){
                if (isLayerShowing('wifi')){
                    submitNoPW('wifi_status');
                    submitNoPW('wifi_list');
                }
                else if (isLayerShowing('upgrade')){
                    checkAsync('upgrade');
                }
                else if (isLayerShowing('info')){
                    submitNoPW('system_info');
                }
                else if(isLayerShowing("web_interface")){
                    submitSync('web_interface_disable');
                    submitSync('web_interface_localhost');
                    submitSync('web_interface_https');
                    submitSync('web_interface_authentication');
                }
            }

            /**
             * When a layer is shown
             */
            function onLayerShown(layer){

                if(layer == "wifi"){
                    submitSync('wifi_status');
                    submitSync('wifi_list');
                }
                else if(layer == "upgrade"){
                    checkAsync('upgrade');
                }
                else if(layer == "info"){
                    submitSync('system_info');
                }
                else if(layer == "tz"){
                    submitSync('tz_get');
                    submitSync('tz_list');
                }
                else if(layer == "ssh_layer"){
                    submitSync('ssh_dis');
                }
                else if(layer == "web_interface"){
                    submitSync('web_interface_disable');
                    submitSync('web_interface_localhost');
                    submitSync('web_interface_https');
                    submitSync('web_interface_authentication');
                    submitSync('web_interface_share');
                    submitSync('rover_info');
                    submitSync('downman');
                }
                else if(layer == "lcd"){
                    submitSync('lcd');
                }
                else if(layer == "overclock"){
                    submitSync('overclock');
                }
                else if(layer == "keyboard"){
                    submitSync('keyboard_get');
                    submitSync('keyboard_list');
                }
                else if(layer == "mail"){
                    submitSync('mail_get');
                }
                else if(layer == "sshfs"){
                    submitSync('sshfs_get');
                    submitSync('sshfs_local_get');
                }
                else if(layer == "samba"){
                    submitSync('samba_get');
                    submitSync('samba_local_get');
                }
                else if(layer == "monitor"){
                    submitSync('monitor_disable');
                }
                else if(layer == "camera"){
                    submitSync('camera');
                    submitSync('stream');
                }
                else if(layer == "hostname"){
                    submitSync('hostname_get');
                }
                else if(layer == "download"){
                    submitSync('download');
                }
                else if(layer == "gpu"){
                    submitSync('gpu_mem_get');
                }
            }
            
            /**
             * On submit command
             */
            function onWork(command){
            }

            /**
             * On answer from submit dommand
             */
            function onSleep(command){
            }

            
            /**
             * On window resize
             */
            function onResize(width, height){
                if(width > 600){
                    if (isLayerShowing('main')){
                        showLayer('main2');
                    }
                }
                else{
                    if (isLayerShowing('main2')){
                        showLayer('main');
                    }
                }
            }            
            
            //]]>
        </script>
        
    </head>
    <body>
        <table class="bar">
            <thead>
                <tr>
                    <td>
                        <img alt="logo" src="img/bar_steelsquid.png"></img>
                    </td>
                    <td>
                        Kiss OS Administrator
                    </td>
                    <td>
                        <img alt="logo" src="img/bar_menu.png"></img>
                    </td>
                </tr>
            </thead>
            <tbody>
                <tr onclick="javascript:window.location = 'http://www.steelsquid.org/steelsquid-kiss-os';">
                    <td>
                        <img alt="logo" src="img/bar_help.png"></img>
                    </td>
                    <td colspan="2" >
                        Help
                    </td>
                </tr>
                <tr onclick="javascript:window.location = '/file';">
                    <td>
                        <img alt="logo" src="img/bar_file.png"></img>
                    </td>
                    <td colspan="2" >
                        File Manager
                    </td>
                </tr>
                <tr onclick="javascript:window.location = '/download';">
                    <td>
                        <img alt="logo" src="img/bar_download.png"></img>
                    </td>
                    <td colspan="2" >
                        Download Manager
                    </td>
                </tr>
                <tr onclick="javascript:window.location = '/play';">
                    <td>
                        <img alt="logo" src="img/bar_play.png"></img>
                    </td>
                    <td colspan="2" >
                        Media Player
                    </td>
                </tr>
                <tr onclick="javascript:window.location = '/utils';">
                    <td>
                        <img alt="logo" src="img/bar_utils.png"></img>
                    </td>
                    <td colspan="2" >
                        Utils
                    </td>
                </tr>
                <tr onclick="javascript:submitSyncConfirm('Are you sure you want to reboot?', 'reboot');">
                    <td>
                        <img alt="logo" src="img/bar_reboot.png"></img>
                    </td>
                    <td colspan="2" >
                        Reboot
                    </td>
                </tr>
                <tr onclick="javascript:submitSyncConfirm('Are you sure you want to shutdown?', 'shutdown');">
                    <td>
                        <img alt="logo" src="img/bar_shutdown.png"></img>
                    </td>
                    <td colspan="2" >
                        Shutdown
                    </td>
                </tr>
            </tbody>
        </table>
        <div class="flow">
            <!--####################################################################################################-->
            <div class="layer" id="main">
                <table class="menu">
                    <thead>
                        <tr>
                            <th colspan="2">
                                Network / Sharing
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr onclick="javascript:showLayer('wifi');">
                            <td>
                                <img alt="logo" src="img/network_wireless.png"></img>
                            </td>
                            <td>
                                Wireless network
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('sshfs');">
                            <td>
                                <img alt="logo" src="img/folder_remote.png"></img>
                            </td>
                            <td>
                                SSH network share
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('samba');">
                            <td>
                                <img alt="logo" src="img/samba.png"></img>
                            </td>
                            <td>
                                Windows network share
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('hostname');">
                            <td>
                                <img alt="logo" src="img/hostname.png"></img>
                            </td>
                            <td>
                                Hostname
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('download');">
                            <td>
                                <img alt="logo" src="img/download.png"></img>
                            </td>
                            <td>
                                Download manager
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <table class="menu">
                    <thead>
                        <tr>
                            <th colspan="2">
                                Settings / Configurations
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr onclick="javascript:showLayer('info');">
                            <td>
                                <img alt="logo" src="img/status.png"></img>
                            </td>
                            <td>
                                Status
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('password');">
                            <td>
                                <img alt="logo" src="img/password.png"></img>
                            </td>
                            <td>
                                Change password
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('tz');">
                            <td>
                                <img alt="logo" src="img/time.png"></img>
                            </td>
                            <td>
                                Date and Time
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('keyboard');">
                            <td>
                                <img alt="logo" src="img/keyboard.png"></img>
                            </td>
                            <td>
                                Keyboard
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('mail');">
                            <td>
                                <img alt="logo" src="img/mail.png"></img>
                            </td>
                            <td>
                                Notification Email
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('monitor');">
                            <td>
                                <img alt="logo" src="img/display.png"></img>
                            </td>
                            <td>
                                Display
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('camera');">
                            <td>
                                <img alt="logo" src="img/camera.png"></img>
                            </td>
                            <td>
                                Camera
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <table class="menu">
                    <thead>
                        <tr>
                            <th colspan="2">
                                Servers
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr onclick="javascript:showLayer('ssh_layer');">
                            <td>
                                <img alt="logo" src="img/terminal.png"></img>
                            </td>
                            <td>
                                SSH server
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('web_interface');">
                            <td>
                                <img alt="logo" src="img/html.png"></img>
                            </td>
                            <td>
                                Administrator interface
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br/>
                <table class="menu">
                    <thead>
                        <tr>
                            <th colspan="2">
                                System / Hardware
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr onclick="javascript:showLayer('upgrade');">
                            <td>
                                <img alt="logo" src="img/upgrade.png"></img>
                            </td>
                            <td>
                                Upgrade
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('expand');">
                            <td>
                                <img alt="logo" src="img/expand.png"></img>
                            </td>
                            <td>
                                Expand Filesystem
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('overclock');">
                            <td>
                                <img alt="logo" src="img/electronics.png"></img>
                            </td>
                            <td>
                                Overclock/Underclock
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('gpu');">
                            <td>
                                <img alt="logo" src="img/gpu.png"></img>
                            </td>
                            <td>
                                GPU
                            </td>
                        </tr>
                        <tr onclick="javascript:showLayer('lcd');">
                            <td>
                                <img alt="logo" src="img/lcd.png"></img>
                            </td>
                            <td>
                                LCD
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br/>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="main2">
                <table>
                    <tr>
                        <td style="vertical-align:top;">
                            <table class="menu">
                                <thead>
                                    <tr>
                                        <th colspan="2">
                                            Network / Sharing
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr onclick="javascript:showLayer('wifi');">
                                        <td>
                                            <img alt="logo" src="img/network_wireless.png"></img>
                                        </td>
                                        <td>
                                            Wireless network
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('sshfs');">
                                        <td>
                                            <img alt="logo" src="img/folder_remote.png"></img>
                                        </td>
                                        <td>
                                            SSH network share
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('samba');">
                                        <td>
                                            <img alt="logo" src="img/samba.png"></img>
                                        </td>
                                        <td>
                                            Windows network share
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('hostname');">
                                        <td>
                                            <img alt="logo" src="img/hostname.png"></img>
                                        </td>
                                        <td>
                                            Hostname
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('download');">
                                        <td>
                                            <img alt="logo" src="img/download.png"></img>
                                        </td>
                                        <td>
                                            Download manager
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <br />
                            <table class="menu">
                                <thead>
                                    <tr>
                                        <th colspan="2">
                                            Settings / Configurations
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr onclick="javascript:showLayer('info');">
                                        <td>
                                            <img alt="logo" src="img/status.png"></img>
                                        </td>
                                        <td>
                                            Status
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('password');">
                                        <td>
                                            <img alt="logo" src="img/password.png"></img>
                                        </td>
                                        <td>
                                            Change password
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('tz');">
                                        <td>
                                            <img alt="logo" src="img/time.png"></img>
                                        </td>
                                        <td>
                                            Date and Time
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('keyboard');">
                                        <td>
                                            <img alt="logo" src="img/keyboard.png"></img>
                                        </td>
                                        <td>
                                            Keyboard
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('mail');">
                                        <td>
                                            <img alt="logo" src="img/mail.png"></img>
                                        </td>
                                        <td>
                                            Notification Email
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('monitor');">
                                        <td>
                                            <img alt="logo" src="img/display.png"></img>
                                        </td>
                                        <td>
                                            Display
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('camera');">
                                        <td>
                                            <img alt="logo" src="img/camera.png"></img>
                                        </td>
                                        <td>
                                            Camera
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                        <td style="vertical-align:top;">
                            <table class="menu">
                                <thead>
                                    <tr>
                                        <th colspan="2">
                                            Servers
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr onclick="javascript:showLayer('ssh_layer');">
                                        <td>
                                            <img alt="logo" src="img/terminal.png"></img>
                                        </td>
                                        <td>
                                            SSH server
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('web_interface');">
                                        <td>
                                            <img alt="logo" src="img/html.png"></img>
                                        </td>
                                        <td>
                                            Administrator interface
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <br/>
                            <table class="menu">
                                <thead>
                                    <tr>
                                        <th colspan="2">
                                            System / Hardware
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr onclick="javascript:showLayer('upgrade');">
                                        <td>
                                            <img alt="logo" src="img/upgrade.png"></img>
                                        </td>
                                        <td>
                                            Upgrade
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('expand');">
                                        <td>
                                            <img alt="logo" src="img/expand.png"></img>
                                        </td>
                                        <td>
                                            Expand Filesystem
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('overclock');">
                                        <td>
                                            <img alt="logo" src="img/electronics.png"></img>
                                        </td>
                                        <td>
                                            Overclock/Underclock
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('gpu');">
                                        <td>
                                            <img alt="logo" src="img/gpu.png"></img>
                                        </td>
                                        <td>
                                            GPU
                                        </td>
                                    </tr>
                                    <tr onclick="javascript:showLayer('lcd');">
                                        <td>
                                            <img alt="logo" src="img/lcd.png"></img>
                                        </td>
                                        <td>
                                            LCD
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>            
            <!--####################################################################################################-->
            <div class="layer" id="info">
                <table class="sheader">
                    <tr onclick="javascript:onBack();">
                        <th>
                            <img alt="logo" src="img/status.png"></img>
                        </th>
                        <th>
                            Status (<span id="p_date">---</span>)
                        </th>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td style="vertical-align:top;" id="info_row_1">
                        </td>
                        <td style="vertical-align:top;" id="info_row_2">
                        </td>
                    </tr>
                </table>
                <div id="info_1">
                    <table class="keyvalue">
                        <tr>
                            <td>Hostname:</td><td id="p_hostname">---</td>
                        </tr>
                        <tr>
                            <td>Development:</td><td id="p_development">---</td>
                        </tr>
                        <tr>
                            <td>Booted:</td><td id="p_boot">---</td>
                        </tr>
                        <tr>
                            <td>Uptime:</td><td id="p_up">---</td>
                        </tr>
                        <tr>
                            <td>Users:</td><td id="p_users">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>Connected to network: </td><td id="p_access_point">---</td>
                        </tr>
                        <tr>
                            <td>Network Wired IP: </td><td id="p_ip_wired">---</td>
                        </tr>
                        <tr>
                            <td>Network Wifi IP: </td><td id="p_ip_wifi">---</td>
                        </tr>
                        <tr>
                            <td>Internet IP: </td><td id="p_ip_wan">---</td>
                        </tr>
                        <tr>
                            <td>USB 3g/4g modem: </td><td id="p_modem">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>CPU usage:</td><td id="p_cpu">---</td>
                        </tr>
                        <tr>
                            <td>CPU load:</td><td id="p_load">---</td>
                        </tr>
                        <tr>
                            <td>CPU freq:</td><td id="p_cpu_f">---</td>
                        </tr>
                        <tr>
                            <td>Processes:</td><td id="p_count">---</td>
                        </tr>
                        <tr>
                            <td>Temperatur:</td><td id="p_temp">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>Total RAM:</td><td id="p_ram_total">---</td>
                        </tr>
                        <tr>
                            <td>Used RAM:</td><td id="p_ram_used">---</td>
                        </tr>
                        <tr>
                            <td>Free RAM:</td><td id="p_ram_free">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>Total sdcard:</td><td id="p_disk_size">---</td>
                        </tr>
                        <tr>
                            <td>Used sdcard:</td><td id="p_disk_used">---</td>
                        </tr>
                        <tr>
                            <td>Free sdcard:</td><td id="p_disk_aval">---</td>
                        </tr>
                    </table>
                </div>
                <br />
                <div id="info_2">
                    <table class="keyvalue">
                        <tr>
                            <td>Overclock:</td><td id="p_overclock">---</td>
                        </tr>
                        <tr>
                            <td>GPU Mem:</td><td id="p_gpu_mem">---</td>
                        </tr>
                        <tr>
                            <td>Logging:</td><td id="p_log">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>Display:</td><td id="p_disable_monitor">---</td>
                        </tr>
                        <tr>
                            <td>PI camera:</td><td id="p_camera">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>Timezone:</td><td id="p_timezone">---</td>
                        </tr>
                        <tr>
                            <td>Keyboard:</td><td id="p_keyb">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>Administrator interface:</td><td id="p_web">---</td>
                        </tr>
                        <tr>
                            <td>Type:</td><td id="p_web_https">---</td>
                        </tr>
                        <tr>
                            <td>Authentication:</td><td id="p_web_aut">---</td>
                        </tr>
                        <tr>
                            <td>Listening on:</td><td id="p_web_local">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>SSH-server:</td><td id="p_ssh">---</td>
                        </tr>
                        <tr>
                            <td>Socket server:</td><td id="p_socket">---</td>
                        </tr>
                    </table>
                    <br />
                    <table class="keyvalue">
                        <tr>
                            <td>LCD:</td><td id="p_has_lcd">---</td>
                        </tr>
                        <tr>
                            <td>Stream USB camera:</td><td id="p_stream">---</td>
                        </tr>
                        <tr>
                            <td>Rover:</td><td id="p_rover">---</td>
                        </tr>
                        <tr>
                            <td>Download manager:</td><td id="p_download">---</td>
                        </tr>
                        <tr>
                            <td>Download dir:</td><td id="p_download_dir">---</td>
                        </tr>
                        <tr>
                            <td>Steelsquid IO Board:</td><td id="p_io">---</td>
                        </tr>
                        <tr>
                            <td>Clean power off:</td><td id="p_power">---</td>
                        </tr>
                    </table>
                </div>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="wifi">
                <table class="sheader">
                    <tr onclick="javascript:onBack();">
                        <th>
                            <img alt="logo" src="img/network_wireless.png"></img>
                        </th>
                        <th>Wireless network</th>
                    </tr>
                </table>
                <table class="keyvalue">
                    <tr>
                        <td>Connected to network:</td><td class="highlight" id="wifi_connected">---</td>
                    </tr>
                    <tr>
                        <td>Network Wired IP:</td><td id="wifi_wired">---</td>
                    </tr>
                    <tr>
                        <td>Network Wifi IP:</td><td id="wifi_wifi">---</td>
                    </tr>
                    <tr>
                        <td>Internet IP:</td><td id="wifi_wan">---</td>
                    </tr>
                </table>
                <br />
                It can currently only handle <span class="highlight">WEP</span>, <span class="highlight">WPA</span> and an open network.<br/>
                Below are all available Wifi networks, click on the name to connect.<br/>
                If a fixed network is available, it will be prefered.<br />
                It may take a little while before the connection is completed. <br />
                Once you've got an IP number (Network Wifi IP) then you are connected. <br />
                If no ip shows up after about a minute then you have probably entered the wrong password.
                <br /><br />
                <table id="wifi_list" class="list">
                    <thead>
                        <tr>
                            <th>Security</th><th class="expand">Name</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr><td></td></tr>
                    </tbody>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="sshfs">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/folder_remote.png"></img>
                            </th>
                            <th>
                                SSH network share
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Mount a directory on a remote SSH-server to a local folder.<br />
                                All you add will automatically be mounted when the computer starts.<br />
                                Everything will be mounted under <span class="highlight">/mnt/network/</span> but a link will also be created in you <span class="highlight">home</span> folder.<br />
                                If you intend to adding a new mount poin and have a <span class="highlight">encrypted</span> file system, you must log in (SSH, Terminal or Desktop) with the user "steelsquid" to decrypt the home directory before you can continue.<br/>
                                <br/>
                                Fill out the information for your server below and hit the <span class="highlight">'Add SSH-share'</span> button.<br />
                                Then press the <span class="highlight">'Mount'</span> button to test that it works...<br />
                                <br/>
                                Mount and umount script will also be created in your home directory.
                                <ul>
                                    <li>Mount-[Local folder name].sh</li>
                                    <li>Umount-[Local folder name].sh</li>
                                </ul>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table class="input">
                    <tbody>
                        <tr>
                            <td>
                                IP or hostname to the SSH-server
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="sshfs_ip" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Port number to the SSH-server
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="sshfs_port" value="22" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Username to the SSH-server
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="sshfs_user" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Passworde to the SSH-server (Leave blank to disable automatic mount on boot)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="sshfs_password" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Remote SSH-server path
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="sshfs_remote" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Local folder (mount point) to mount SSH-server path
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table>
                                    <tr>
                                        <td colspan="2" style="padding-bottom:2px;margin-bottom:0px">
                                            <select id="sshfs_local_list">
                                                <option value="dummy"></option>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-right:2px">
                                            <button onclick="javascript:submitSyncFromPrompt('sshfs_local_add', 'Please enter a name for the mount point', 'Videos')">Add mount point</button>
                                        </td>
                                        <td>
                                            <button onclick="javascript:submitSyncFromInputConfirm('Are you sure you want to remove the mount point', 'sshfs_local_del', 'sshfs_local_list')">Remove mount point</button>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <button onclick="javascript:submitSyncFromInput('sshfs_add', 'sshfs_ip', 'sshfs_port', 'sshfs_user', 'sshfs_password', 'sshfs_local_list', 'sshfs_remote')">Add SSH-share</button>
                <br /><br />
                <table id="sshfs_list" class="list">
                    <thead>
                        <tr>
                            <th></th><th>IP:Port<br />User</th><th>Remote SSH path<br />Local path</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr><td></td></tr>
                    </tbody>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="samba">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/samba.png"></img>
                            </th>
                            <th>
                                Windows network share
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Mount a Windows share (SAMBA) to a local folder.<br />
                                All you add will automatically be mounted when the computer starts.<br />
                                Everything will be mounted under <span class="highlight">/mnt/network/</span> but a link will also be created in you <span class="highlight">home</span> folder.<br />
                                If you intend to adding a new mount poin and have a <span class="highlight">encrypted</span> file system, you must log in (SSH, Terminal or Desktop) with the user "steelsquid" to decrypt the home directory before you can continue.<br/>
                                <br/>
                                Fill out the information for your server below and hit the <span class="highlight">'Add Windows-share'</span> button.<br />
                                Then press the <span class="highlight">'Mount'</span> button to test that it works...<br />
                                <br/>
                                If you dont know the name of the share on the server you can press <span class="highlight">'List shares on the server'</span> to retrieve them.<br/>
                                <br/>
                                Mount and umount script will also be created in your home directory.
                                <ul>
                                    <li>Mount-[Local folder name].sh</li>
                                    <li>Umount-[Local folder name].sh</li>
                                </ul>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table class="input">
                    <tbody>
                        <tr>
                            <td>
                                IP or hostname to the server
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="samba_ip" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Username to the server (Leave blank if not required)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="samba_user" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Passworde to the server (Leave blank if not required)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="samba_password" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Name of the share on the server
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table>
                                    <tr>
                                        <td colspan="2" style="padding-bottom:2px;margin-bottom:0px">
                                            <div id="samba_remote_div">
                                                <input type="text" id="samba_remote" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-right:2px">
                                            <button onclick="javascript:submitSyncFromInput('samba_list', 'samba_ip', 'samba_user', 'samba_password')">List shares on the server</button>
                                        </td>
                                        <td>
                                            <button onclick="javascript:clearSambaRemoteDiv();">Clear</button>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Local folder (mount point) to mount share in
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table>
                                    <tr>
                                        <td colspan="2" style="padding-bottom:2px;margin-bottom:0px">
                                            <select id="samba_local_list">
                                                <option value="dummy"></option>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-right:2px">
                                            <button onclick="javascript:submitSyncFromPrompt('samba_local_add', 'Please enter a name for the mount point', 'Videos')">Add mount point</button>
                                        </td>
                                        <td>
                                            <button onclick="javascript:submitSyncFromInputConfirm('Are you sure you want to remove the mount point', 'samba_local_del', 'samba_local_list')">Remove mount point</button>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <button onclick="javascript:submitSyncFromInput('samba_add', 'samba_ip', 'samba_user', 'samba_password', 'samba_local_list', 'samba_remote')">Add Windows-share</button>
                <br /><br />
                <table id="samba_list" class="list">
                    <thead>
                        <tr>
                            <th></th><th>IP:Port<br />User</th><th>Share name<br />Local path</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr><td></td></tr>
                    </tbody>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="hostname">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/hostname.png"></img>
                            </th>
                            <th>
                                Hostname
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Set name for this device.<br />
                                This will also change the name of this device on the network.<br />
                                The changes will be implemented after you <span class="highlight">reboot</span> your device.<br/>
                            </td>
                        </tr>
                    </tbody>
                </table>

                <table class="input">
                    <tbody>
                        <tr>
                            <td>
                                Name of device
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="hostname_name" name="hostname_name" />
                                <button onclick="javascript:submitSyncFromInputConfirm('Are you sure you want to change hostname?', 'hostname_set', 'hostname_name')">Change hostname</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                You need to <span class="highlight">reboot</span> the device for any changes to take effect.
                <button onclick="javascript:submitSyncConfirm('Are you sure you want to reboot?', 'reboot');">Reboot</button>
                <br /><br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>    
            <!--####################################################################################################-->
            <div class="layer" id="download">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/download.png"></img>
                            </th>
                            <th>
                                Download manager
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Activate/deactivate the download manager and where do you want the files to be downloaded.<br />
                                Download manager is accessed from the black top menu.
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table class="input">
                    <tbody>
                        <tr>
                            <td>
                                Download directory
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="download_dir" name="download_dir" />
                                <button onclick="javascript:submitSyncFromInput('download', 'download_dir')">Change directory</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="download_status">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td>
                            <button id="download_enable" onclick="javascript:submitSync('download', 'True');">Enable</button>
                        </td>
                        <td>
                            <button id="download_disable" onclick="javascript:submitSync('download', 'False');">Disable</button>
                        </td>
                    </tr>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>    
            <!--####################################################################################################-->
            <div class="layer" id="tz">
                <table class="sheader">
                    <tr onclick="javascript:onBack();">
                        <th>
                            <img alt="logo" src="img/time.png"></img>
                        </th>
                        <th>Date and Time</th>
                    </tr>
                </table>
                <table class="keyvalue">
                    <tbody>
                        <tr>
                            <td>Current timezone:</td><td id="tz_current">---</td>
                        </tr>
                        <tr>
                            <td colspan="2" style="padding:2px"></td>
                        </tr>
                        <tr>
                            <td colspan="2" id="tz_date"></td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <table id="tz_list" class="list">
                    <thead>
                        <tr>
                            <th>Select your timezone below</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr><td></td></tr>
                    </tbody>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="keyboard">
                <table class="sheader">
                    <tr onclick="javascript:onBack();">
                        <th>
                            <img alt="logo" src="img/keyboard.png"></img>
                        </th>
                        <th>Keyboard</th>
                    </tr>
                </table>
                <table class="keyvalue">
                    <tbody>
                        <tr>
                            <td>Current keyboard layout:</td><td id="keyboard_current">---</td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <table id="keyboard_list" class="list">
                    <thead>
                        <tr>
                            <th colspan="2">Select new keyboard layout below</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr><td></td></tr>
                    </tbody>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="mail">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/mail.png"></img>
                            </th>
                            <th>
                                Notification Email
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Fill this out if you want an email from the system on certain events.<br />
                                <br/>
                                Contact your ISP for this information.<br/>
                                It is also possible to use a gmail account.<br/>
                                SMTP server: <span class="highlight">smtp.gmail.com:587</span><br/>
                                Username: Your gmail user (without @gmail.com)<br/>
                                Password: Your gmail password
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table class="input">
                    <tbody>
                        <tr>
                            <td>
                                SMTP server
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="mail_host"></input>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Username (If not required leave blank)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="mail_username"></input>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Password (If not required leave blank)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="password" id="mail_password"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Email that you want notification sent to
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="mail_mail"/>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table class="input">
                    <tr>
                        <td>
                            <button onclick="javascript:submitSyncFromInput('mail_set', 'mail_host', 'mail_username', 'mail_password', 'mail_mail')">Save</button>
                        </td>
                        <td>
                            <button onclick="javascript:submitSyncFromInput('mail_test', 'mail_host', 'mail_username', 'mail_password', 'mail_mail')">Test settings</button>
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="password">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/password.png"></img>
                            </th>
                            <th>
                                Change password
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                This will apply to all types of logins (web admin, command line, SSH, video play and desktop).<br/>
                                Afterwards you will need to login again with the new password.<br/>
                                It may take a few seconds for the changes to take effect.<br/>
                                I recommend changing the password to mixed letters and numbers.
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table class="input">
                    <tbody>
                        <tr>
                            <td>
                                Current password for user root
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="password" id="password_current"></input>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                New password for user root
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="password" id="password_password_1"></input>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Confirm new password for user root
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="password" id="password_password_2"></input>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <button onclick="javascript:submitSyncFromInput('password', 'password_password_1', 'password_password_2', 'password_current');$('#password_current').val('');">Change password</button>
                <br /><br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="ssh_layer">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/folder_remote.png"></img>
                            </th>
                            <th>
                                SSH server
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Here you can enable or disable the SSH server.<br/>
                                If you do not intend to use SSH i recommend <span class="highlight">disabling</span> it.
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="ssh_disable_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="ssh_disable_button">
                        </td>
                    </tr>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="web_interface">
                <table class="sheader">
                    <tr onclick="javascript:onBack();">
                        <th>
                            <img alt="logo" src="img/html.png"></img>
                        </th>
                        <th>
                            Administrator interface
                        </th>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td>
                            If you do not nead this administrator interface, you can disable it here. <br />
                            But you can then only use the command line to configure the system.<br/>
                            I recommend <span class="highlight">not</span> to disable the administrator interface.
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="web_interface_disable_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="web_interface_disable_button">
                        </td>
                    </tr>
                </table>
                <br/>
                <br />
                <table>
                    <tr>
                        <td>
                            If you must enter user/password to connect to the web interface from the network (internet).<br />
                            If you have a private LAN with trusted computers it can be nice to avoid having to enter the password.<br />
                            If you make changes here you can get a temporary "Connection error", this is because the web server needs to reboot.<br/>
                            I recommend having <span class="highlight">authentication enabled</span>.
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="web_interface_authentication_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="web_interface_authentication_button">
                        </td>
                    </tr>
                </table>
                <br/>
                <br />
                <table>
                    <tr>
                        <td>
                            You can also listen on localhost or on all interfaces. <br />
                            Listening to localhost means that you can only access it from the local device.<br />
                            Otherwise you can connect from any computer on the network.<br/>
                            If you make changes here you can get a temporary "Connection error", this is because the web server needs to reboot.<br/>
                            I recommend to only listening on <span class="highlight">localhost</span>.
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="web_interface_localhost_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="web_interface_localhost_button">
                        </td>
                    </tr>
                </table>
                <br/>
                <br />
                <table>
                    <tr>
                        <td>
                            Choose whether to use secure HTTPS or unsecure HTTP. <br />
                            If you select HTTPS, the browser may complain about unverified certificates (Press go ahead anyway).<br/>
                            This will reset the port number to default (HTTP: 80, HTTPS: 443).<br />
                            If you make changes here you can get a temporary "Connection error", this is because the web server needs to reboot.<br/>
                            I recommend <span class="highlight">HTTPS</span> if you selected "listen on all interfaces" above.<br/>
                            If you selected "listen on localhost" i recommend <span class="highlight">HTTP</span>.
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="web_interface_https_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="web_interface_https_button">
                        </td>
                    </tr>
                </table>
                <br/>
                <br />
                <table>
                    <tr>
                        <td>
                            Make <span class="highlight">/root</span> accessible from this web interface? <br />
                            Default only /opt/steelsquid/web can be accessed from this web interface.<br/>
                            If you using the web <span class="highlight">File Manager</span> or <span class="highlight">Media Player</span> you must enable acces to these directorys.<br />
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="web_interface_share_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="web_interface_share_button">
                        </td>
                    </tr>
                </table>
                <br/>
                <br />
                <table>
                    <tr>
                        <td>
                            Enable/disable the Rover Controller on this system
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="rover_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="rover_button">
                        </td>
                    </tr>
                </table>
                <br/>
                <br />
                <table>
                    <tr>
                        <td>
                            Enable/disable the Download manager on this system
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="download_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="download_button">
                        </td>
                    </tr>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="upgrade">
                <table class="sheader">
                    <tr onclick="javascript:onBack();">
                        <th>
                            <img alt="logo" src="img/upgrade.png"></img>
                        </th>
                        <th>
                            Upgrade
                        </th>
                    </tr>
                </table>
                Choose the type of upgrade you want to perform.<br />
                <ul>
                    <li>
                        Small upgrade<br/>
                        Will only upgrade the main parts. The process takes a few minutes.
                    </li>
                    <li>
                        Full upgrade<br />
                        Choose this if you also want to upgrade the firmware.<br/>
                        The process can take hours depending on how old your system is.
                    </li>
                </ul>
                When the update is complete you must <span class="highlight">reboot</span> the device.<br />
                <span class="highlight">NOTE!</span> Do not turn off the device while the upgrade is in progress and the device must have internet connection.
                <br/><br/>
                <table class="grid">
                    <tr>
                        <td>
                            <button id="upgrade_button_small" onclick="javascript:submitAsyncConfirm('Are you sure you want to upgrade the system?', 'upgrade', 'small');">Small upgrade</button>
                        </td>
                        <td>
                            <button id="upgrade_button_full" onclick="javascript:submitAsyncConfirm('Are you sure you want to upgrade the system?', 'upgrade', 'full');">Full upgrade</button>
                        </td>
                    </tr>
                </table>
                <br/>
                <span id="upgrade_status"></span>
                <div class="log" id="upgrade_log">
                </div>
                <button id="upgrade_button_reset" disabled="disabled" onclick="javascript:checkAsyncConfirm('Are you sure you want to clear the execution log?', 'upgrade', 'pre')">Clear execution status</button>
                <br/><br/>
                <table class="input">
                    <tr>
                        <td>
                            You need to <span class="highlight">reboot</span> the device for any changes to take effect.
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <button onclick="javascript:submitSyncConfirm('Are you sure you want to reboot?', 'reboot');">Reboot</button>
                        </td>
                    </tr>
                </table>
                <br/>
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="expand">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/expand.png"></img>
                            </th>
                            <th>
                                Expand Filesystem
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Ensures that all of the SD card storage is available to the OS.<br />
                                Will take effect on next reboot...
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <button onclick="javascript:submitSyncConfirm('Are you sure you want to expand the filesystem?', 'expand')">Expand filesystem</button>
                <br /><br />
                <div id="expand_status">
                </div>
                <div class="hide" id="expand_reboot">
                    <button onclick="javascript:submitSyncConfirm('Are you sure you want to reboot?', 'reboot');">Reboot</button> 
                    <br /><br />
                </div>
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="monitor">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/display.png"></img>
                            </th>
                            <th>
                                Display
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Here you can enable or disable the display. <br />
                                This will affect both hdmi and composite.<br />
                                If there is a desktop environment it will be useless.<br />
                                If you disable the display and reboot the device, the display will turned on at boot but power off after a few seconds.<br />
                                This is useful if you have a headless environment, will save a little power.
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="monitor_disable_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="monitor_disable">
                        </td>
                    </tr>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="camera">
                <table class="sheader">
                    <tr onclick="javascript:onBack();">
                        <th>
                            <img alt="logo" src="img/camera.png"></img>
                        </th>
                        <th>
                            Camera
                        </th>
                    </tr>
                </table>
                <table>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Here you can enable or disable the Raspberry Pi camera. <br />
                                You need to <span class="highlight">reboot</span> the device for any changes to take effect.
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="camera_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="camera_button">
                        </td>
                        <td>
                            <button onclick="javascript:submitSyncConfirm('Are you sure you want to reboot?', 'reboot');">Reboot</button>
                        </td>
                    </tr>
                </table>
                <br /><br/>
                <table>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Here you can enable or disable streaming of a usb camera. <br />
                                This do not work with the Raspberry Pi camera.<br/>
                                The stream can be reached from http://[ipToRaspberry]:8080/?action=stream<br/>
                                e.g. &lt;img src="http://[ipToRaspberry]:8080/?action=stream"/&gt;<br/>
                                You can see the result under 'Utils'.<br/>
                                You need to <span class="highlight">reboot</span> the device for any changes to take effect.
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="stream_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="stream_button">
                        </td>
                        <td>
                            <button onclick="javascript:submitSyncConfirm('Are you sure you want to reboot?', 'reboot');">Reboot</button>
                        </td>
                    </tr>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="overclock">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/electronics.png"></img>
                            </th>
                            <th>
                                Overclock/Underclock
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Overclock will increase the cpu speed to 1000MHz (May set the warranty bit and shorten the life of the device).<br />
                                Underclocking will decrease the cpu speed to 140MHz (will reduce power consumption slightly, but will make the system very slow).<br />
                                Will take effect on <span class="highlight">next reboot</span>...
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="overclock_button_info">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td id="overclock_button_under">
                        </td>
                        <td id="overclock_button_default">
                        </td>
                        <td id="overclock_button_over">
                        </td>
                    </tr>
                </table>
                <br />
                <table class="input">
                    <tr>
                        <td>
                            You need to <span class="highlight">reboot</span> the device for any changes to take effect.
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <button onclick="javascript:submitSyncConfirm('Are you sure you want to reboot?', 'reboot');">Reboot</button>
                        </td>
                    </tr>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
            <!--####################################################################################################-->
            <div class="layer" id="gpu">
                <table class="header">
                    <thead>
                        <tr onclick="javascript:onBack();">
                            <th>
                                <img alt="logo" src="img/gpu.png"></img>
                            </th>
                            <th>
                                GPU
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="2">
                                Sets the memory for the GPU. ARM (CPU) gets the remaining memory. <br/>
                                Min=16, max=448 and default 64 .<br />
                                The changes will be implemented after you <span class="highlight">reboot</span> your device.<br/>
                            </td>
                        </tr>
                    </tbody>
                </table>

                <table class="input">
                    <tbody>
                        <tr>
                            <td>
                                GPU memory in MB
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="gpu_mem" name="gpu_mem" />
                                <button onclick="javascript:submitSyncFromInputConfirm('Are you sure you want to change GPU memory use?', 'gpu_mem_set', 'gpu_mem')">Change</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                You need to <span class="highlight">reboot</span> the device for any changes to take effect.
                <button onclick="javascript:submitSyncConfirm('Are you sure you want to reboot?', 'reboot');">Reboot</button>
                <br /><br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>    
            <!--####################################################################################################-->
            <div class="layer" id="lcd">
                <table class="sheader">
                    <tr onclick="javascript:onBack();">
                        <th>
                            <img alt="logo" src="img/lcd.png"/>
                        </th>
                        <th >
                            LCD
                        </th>
                    </tr>
                </table>
                <table>
                    <tbody>
                        <tr>
                            <td>
                                You can print text on a <a href="http://tronixlabs.com/news/tutorial-serial-i2c-backpack-for-hd44780compatible-lcd-modules-with-arduino/">HDD44780</a> compatible LCD via <span class="highlight">I2C</span>.<br/>
                                You can also connect a <a href="https://www.sparkfun.com/products/10168">nokia5110</a> LCD.<br/>
                                Automatic will try both nokia5110, HDD44780 or ssd1306 (oled).<br/>
                                See <a href="http://www.steelsquid.org/pi-io-example">http://www.steelsquid.org/pi-io-example</a><br/>
                                The IP of the device will also be displayed on the LCD<br/>
                                <br/>
                                If you change this you will get "Connection error" while service restart...
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br/>
                <table class="keyvalue">
                    <tr>
                        <td>
                            Current status:
                        </td>
                        <td id="lcd_status">
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td>
                            <button id="lcd_button_disable"  onclick="javascript:submitSync('lcd_disable');">Disable</button>
                        </td>
                        <td>
                            <button id="lcd_button_auto"  onclick="javascript:submitSync('lcd_auto');">Automatic</button>
                        </td>
                        <td>
                            <button id="lcd_button_hdd"  onclick="javascript:submitSync('lcd_hdd');">HDD44780</button>
                        </td>
                        <td>
                            <button id="lcd_button_nokia"  onclick="javascript:submitSync('lcd_nokia');">nokia5110</button>
                        </td>
                        <td>
                            <button id="lcd_button_ssd"  onclick="javascript:submitSync('lcd_ssd');">ssd1306</button>
                        </td>
                    </tr>
                </table>
                <br />
                <table class="footer">
                    <tr onclick="javascript:onBack();">
                        <td>
                            <img alt="logo" src="img/back.png"></img>
                        </td>
                        <td>
                            Back to main menu
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </body>
</html>
